#include "component.h"

/*  */
void my_memcpy(void* tar, const void* src, unsigned int len)
{
    char* target = (char*)tar;
    char* source = (char*)src;
    unsigned int count = 0;

    if (target <= source || target > (source + len))  /* --> */
    {
        while (len--)
        {
            *target++ = *source++;
        }
    }
    else  /* <-- */
    {
        for (count = len; count > 0; count--)
        {
            target[count - 1] = source[count - 1];
        }
    }
}

/*  */
void my_memset(char* buf, char val, unsigned int len)
{
    while (len--)
    {
        *buf++ = val;
    }
}

